﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ket_noi_toi_VPP_bang_mo_hinh_ba_lop.VO;
using System.Data;

namespace Ket_noi_toi_VPP_bang_mo_hinh_ba_lop.VO
{
    class UserVONhanVien
    {
        private int _MaNV;
        private string _HoTen;
        private DateTime _NgaySinh;
        private string _DienThoai;
        private string _DiaChi;
        private string _GT;
        private string _TenDN;
        private string _Pass;
        private string _QuyenDN;

        public UserVONhanVien(int MaNV, string HoTen, DateTime NgaySinh, string DienThoai, string DiaChi, string Gioitinh, string TenDN, string Pass, string QuyenDN)
        {
            this._MaNV = MaNV;
            this._HoTen = HoTen;
            this._NgaySinh = NgaySinh;
            this._DienThoai = DienThoai;
            this._DiaChi = DiaChi;
            this._GT = Gioitinh;
            this._TenDN = TenDN;
            this._Pass = Pass;
            this._QuyenDN = QuyenDN;
        }
        public int MANHANVIEN
        {
            get { return _MaNV; }
            set { _MaNV = value; }
        }

        public string HOTEN
        {
            get { return _HoTen; }
            set { _HoTen = value; }
        }

        public DateTime NGAYSINH
        {
            get { return _NgaySinh; }
            set { _NgaySinh = value; }
        }

        public string DIENTHOAI
        {
            get { return _DienThoai; }
            set { _DienThoai = value; }
        }
        
        public string DIACHI
        {
            get { return _DiaChi; }
            set { _DiaChi = value; }
        }

        public string GIOITINH
        {
            get { return _GT; }
            set { _GT = value; }
        }

        public string TENDANGNHAP
        {
            get { return _TenDN; }
            set { _TenDN = value; }
        }
        
        public string PASSWORD
        {
            get { return _Pass; }
            set { _Pass = value; }
        }

        public string QUYENDANGNHAP
        {
            get { return _QuyenDN; }
            set { _QuyenDN = value; }
        }

        public void CreateFormCTHD(DataRow dr)
        {
            if (dr != null)
            {
                this._MaNV = dr.IsNull(0) ? 0 : Convert.ToInt32(dr[0]);
                this._HoTen = dr.IsNull(1) ? string.Empty : Convert.ToString(dr[1]);
                this._NgaySinh = dr.IsNull(2) ? DateTime.Now : Convert.ToDateTime(dr[2]);
                this._DienThoai = dr.IsNull(3) ? string.Empty : Convert.ToString(dr[3]);
                this._DiaChi = dr.IsNull(4) ? string.Empty : Convert.ToString(dr[4]);
                this._GT = dr.IsNull(5) ? string.Empty : Convert.ToString(dr[5]);
                this._TenDN = dr.IsNull(6) ? string.Empty : Convert.ToString(dr[6]);
                this._Pass = dr.IsNull(7) ? string.Empty : Convert.ToString(dr[7]);
                this._QuyenDN = dr.IsNull(8) ? string.Empty : Convert.ToString(dr[8]);               
            }
        }
    }
}
